package com.example.hudongwx.myclass0719application;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

@ContentView(R.layout.activity_brow2)
public class Brow2Activity extends AppCompatActivity {

    String  TAG="Brow2Activity";

    @ViewInject(R.id.brow2_webview)
  private WebView webView;
    @ViewInject(R.id.brow2_textview)
    private TextView textView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);

        //获取值
      String url=  getIntent().getStringExtra("url");
          if (!TextUtils.isEmpty(url)){
           webView.getSettings().setJavaScriptEnabled(true);
              webView.setWebViewClient(new WebViewClient(){
                  @Override
                  public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
                      return true;
                  }
              });
              webView.setWebChromeClient(new WebChromeClient(){
                  @Override
                  public void onReceivedTitle(WebView view, String title) {
                      textView.setText(title);

                  }
              });
         webView.loadUrl(url);
              Log.i(TAG, "onCreate: "+url);
          }

    }
    @Event(R.id.brow2_imageview)
    private void shut(View v){
        finish();
    }
}
